import send from './http'
const LOGIN = 'login'
const checkBeforeLogin = 'checkBeforeLogin'
const PUSHSOCKETLOGINED = 'app.push.pushSocketLogined'
export default {
  login (data) {
    let req = {
      data: data,
      action: LOGIN
    }
    return send.fetch(req, 'post')
  },
  signInBysessionId (data) {
    let req = {
      data: data,
      action: 'loginBySessionId'
    }
    return send.fetchByAuth(req, 'post')
  },
  signInByToken (data) {
    let req = {
      data: data,
      action: 'loginByToken'
    }
    return send.fetchByAuth(req, 'post')
  },
  initSessionId (sessionId) {
    return sessionId
  },
  pushSocketLogined (data) {
    let req = {
      data: data,
      action: PUSHSOCKETLOGINED
    }
    return send.fetch(req, 'post')
  },
  getCurrentDicVersion () {
    let req = {
      data: {},
      action: 'common.getDicCacheVersion'
    }
    return send.fetch(req, 'post')
  },
  updateGuidance (data) {
    let req = {
      data: data,
      action: 'common.updateGuidance'
    }
    return send.fetch(req, 'post')
  },
  updateViewSwitch (data) {
    let req = {
      data: data,
      action: 'config.common.viewSwitch'
    }
    return send.fetch(req, 'post')
  },
  /**
   * 重新发送邮箱验证码
   * @param {Object} data
   * @param {String} data.lastCodeKey
   */
  retryMail2Authcode (data) {
    let req = {
      action: 'config.accountConfig.retryMail2Authcode',
      data
    }
    return send.fetch(req, 'post')
  },
  checkBeforeLogin (data) {
    let req = {
      data: data,
      action: checkBeforeLogin
    }
    return send.fetch(req, 'post')
  },
  bindPhoneBeforeLogin (data) {
    let req = {
      data: data,
      action: 'bindPhoneBeforeLogin'
    }
    return send.fetch(req, 'post')
  },
  getLoginAuthCodeToken (data) {
    let req = {
      data: data,
      action: 'getLoginAuthCodeToken'
    }
    return send.fetchByAuth(req, 'post')
  },
  // webLoginPollMobileAuth (data) {
  //   let req = {
  //     data: data,
  //     action: 'webLoginPollMobileAuth'
  //   }
  //   return send.fetchByAuth(req, 'post')
  // },
  loginToAuthCenter (data) {
    let req = {
      data: data,
      action: 'loginToAuthCenter'
    }
    return send.fetch(req, 'post')
  },
  statisticsReport (data) {
    let req = {
      data: {'flag': data},
      action: 'statistics.report'
    }
    return send.fetchByPublic(req, 'post')
  },
  checkAccountHttps (data) {
    let req = {
      data: data,
      action: 'checkAccountHttps'
    }
    return send.fetch(req, 'post', false, true)
  },
  collectAgentPCInfo (data) {
    let req = {
      data: data,
      action: 'app.collect.collectAgentPCInfo'
    }
    return send.fetch(req, 'post')
  },
  checkAccountName (data) {
    let req = {
      data: data,
      action: 'service.checkAccountName'
    }
    return send.fetchByPublicYy(req, 'post')
  },
  getIndustryDic (data) {
    let req = {
      data: data,
      action: 'service.getIndustryDic'
    }
    return send.fetchByPublicYy(req, 'post')
  },
  updateAccountByHuaWei (data) {
    let req = {
      data: data,
      action: 'service.updateAccountByHuaWei'
    }
    return send.fetchByPublicYy(req, 'post')
  },
  getCheckCode (data) {
    let req = {
      data: data,
      action: 'forgetPassword.getAuthCode'
    }
    return send.fetch(req, 'post')
  },
  checkAuthCode (data) {
    let req = {
      data: data,
      action: 'forgetPassword.checkAuthCode'
    }
    return send.fetch(req, 'post')
  },
  resetPassword (data) {
    let req = {
      data: data,
      action: 'forgetPassword.resetPassword'
    }
    return send.fetch(req, 'post')
  },
  getLoginSecretKey (data) {
    let req = {
      data: data,
      action: 'loginForSafe'
    }
    return send.fetch(req, 'post')
  },
  checkUploadAddress () {
    let req = {
      data: {},
      action: 'common.checkSystemVersion'
    }
    return send.fetch(req, 'post')
  },
  queryRemoteControlAdd (data) {
    let req = {
      data: data,
      action: 'app.remoteassist.getConnInfo'
    }
    return send.fetch(req, 'post')
  }
}
